package other.example;

import java.awt.EventQueue;

import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import java.awt.Button;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTextPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.Font;

public class DatabaseQueryFrame extends JFrame {

	private JPanel contentPane;
	private JTextField objectNameField;
	private JTextField objectTitleField;
	private JTextField dataSourceField;
	private JTextField dataTableField;
	private JTextField timeField;
	private JTextField reportField;
	private JTextField orderField;
	private JTable table;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					DatabaseQueryFrame frame = new DatabaseQueryFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public DatabaseQueryFrame() {
	    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 675, 962);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel objectNameLabel = new JLabel("\u5BF9\u8C61\u540D\u79F0:");
		objectNameLabel.setBounds(14, 6, 81, 28);
		contentPane.add(objectNameLabel);
		
		objectNameField = new JTextField();
		objectNameField.setBounds(110, 7, 164, 26);
		contentPane.add(objectNameField);
		objectNameField.setColumns(10);
		
		JLabel objectTitlelabel = new JLabel("\u6309\u94AE\u6807\u9898:");
		objectTitlelabel.setBounds(14, 47, 72, 18);
		contentPane.add(objectTitlelabel);
		
		objectTitleField = new JTextField();
		objectTitleField.setBounds(110, 46, 164, 24);
		contentPane.add(objectTitleField);
		objectTitleField.setColumns(10);
		
		JLabel windowModelLabel = new JLabel("\u7A97\u53E3\u6A21\u5F0F:");
		
		windowModelLabel.setBounds(14, 86, 72, 18);
		contentPane.add(windowModelLabel);
		
		JComboBox windowModelComboBox = new JComboBox();
		windowModelComboBox.setModel(new DefaultComboBoxModel(new String[] {"\u5D4C\u5165\u5F0F", "\u5F39\u51FA\u5F0F"}));
		windowModelComboBox.setBounds(110, 83, 175, 24);
		contentPane.add(windowModelComboBox);
	     
       
		JLabel selectorColorLabel = new JLabel("\u80CC\u666F\u989C\u8272\uFF1A");
		selectorColorLabel.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent e) {
				    JLabel colorLabel = new JLabel();
			        colorLabel.setOpaque(true);
			        colorLabel.setBackground(Color.WHITE);
			        colorLabel.setBounds(110, 122, 164, 28);
			        contentPane.add(colorLabel);
					Color color = JColorChooser.showDialog(new JFrame(), "?????", null);
                if (color == null) {
                    return;
                }
               colorLabel.setBackground(color);

			}
		});
		selectorColorLabel.setBounds(14, 120, 87, 28);
		contentPane.add(selectorColorLabel);
		Button DataSourceButton = new Button("\u6570 \u636E \u6E90");
		DataSourceButton.setActionCommand("\u6570 \u636E \u6E90");
		DataSourceButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		DataSourceButton.setBounds(8, 167, 87, 25);
		contentPane.add(DataSourceButton);
		
		Button DataTableButton = new Button("\u6570 \u636E \u8868");
		DataTableButton.setBounds(8, 198, 87, 25);
		contentPane.add(DataTableButton);
		
		Button timeColumButton = new Button("\u65F6\u95F4\u5B57\u6BB5");
		timeColumButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		timeColumButton.setBounds(8, 229, 87, 25);
		contentPane.add(timeColumButton);
		
		Button reportButton = new Button("\u62A5\u8868\u683C\u5F0F");
		reportButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		reportButton.setFont(new Font("????", Font.PLAIN, 16));
		reportButton.setBounds(8, 260, 87, 25);
		contentPane.add(reportButton);
		
		Button orderColumn = new Button("\u6392\u5E8F\u5B57\u6BB5");
		orderColumn.setBounds(8, 291, 87, 25);
		contentPane.add(orderColumn);
		
		dataSourceField = new JTextField();
		dataSourceField.setBounds(110, 167, 407, 28);
		contentPane.add(dataSourceField);
		dataSourceField.setColumns(10);
		
		dataTableField = new JTextField();
		dataTableField.setColumns(10);
		dataTableField.setBounds(110, 198, 263, 28);
		contentPane.add(dataTableField);
		
		timeField = new JTextField();
		timeField.setColumns(10);
		timeField.setBounds(110, 229, 263, 28);
		contentPane.add(timeField);
		
		reportField = new JTextField();
		reportField.setColumns(10);
		reportField.setBounds(110, 260, 263, 28);
		contentPane.add(reportField);
		
		orderField = new JTextField();
		
		orderField.setColumns(10);
		orderField.setBounds(110, 291, 263, 28);
		contentPane.add(orderField);
		
		Button queryButton = new Button("\u67E5\u8BE2\u5BF9\u8C61");
		queryButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		queryButton.setBounds(8, 323, 87, 25);
		contentPane.add(queryButton);
		
		Button groupButton = new Button("\u5206\u7EC4");
		groupButton.setBounds(110, 325, 51, 25);
		contentPane.add(groupButton);
	
		JTextPane textPane = new JTextPane();
		textPane.setBounds(10, 357, 622, 194);
		contentPane.add(textPane);
	
		
		table = new JTable();
	
		table.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null}
			},
			new String[] {
				"???", "???????", "????", "???????", "?????", "????"
			}
		));
		
		JScrollPane scrollPane = new JScrollPane(table);
		scrollPane.setBounds(8, 564, 643, 291);
		contentPane.add(scrollPane);
		table.getColumnModel().getColumn(3).setPreferredWidth(155);
        contentPane.add(scrollPane);
        
        JButton okButton = new JButton("\u786E\u5B9A");
        okButton.setBounds(432, 868, 87, 34);
        contentPane.add(okButton);
        
        JButton cancleButton = new JButton("\u53D6\u6D88");
        cancleButton.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent arg0) {
        	}
        });
        cancleButton.setBounds(533, 868, 87, 34);
        contentPane.add(cancleButton);
   
	
	    
	}
}
